# 20 "lexer.mll"
 
open Lexing
open Ast

type error_msg =
	| Invalid_character of char
	| Unterminated_string
	| Unterminated_regexp
	| Unclosed_comment
	| Invalid_escape
	| Invalid_option

exception Error of error_msg * pos

let error_msg = function
	| Invalid_character c when int_of_char c > 32 && int_of_char c < 128 -> Printf.sprintf "Invalid character '%c'" c
	| Invalid_character c -> Printf.sprintf "Invalid character 0x%.2X" (int_of_char c)
	| Unterminated_string -> "Unterminated string"
	| Unterminated_regexp -> "Unterminated regular expression"
	| Unclosed_comment -> "Unclosed comment"
	| Invalid_escape -> "Invalid escape sequence"
	| Invalid_option -> "Invalid regular expression option"

let cur_file = ref ""
let cur_line = ref 1
let all_lines = Hashtbl.create 0
let lines = ref []
let buf = Buffer.create 100

let error e pos =
	raise (Error (e,{ pmin = pos; pmax = pos; pfile = !cur_file }))

let keywords =
	let h = Hashtbl.create 3 in
	List.iter (fun k -> Hashtbl.add h (s_keyword k) k)
		[Function;Class;Static;Var;If;Else;While;Do;For;
		Break;Return;Continue;Extends;Implements;Import;
		Switch;Case;Default;Public;Private;Try;Untyped;
		Catch;New;This;Throw;Extern;Enum;In;Interface;
		Cast;Override;Dynamic;Typedef;Package;Callback;
		Inline;Using];
	h

let init file =
	cur_file := file;
	cur_line := 1;
	lines := []

let save_lines() =
	Hashtbl.replace all_lines !cur_file !lines

let save() =
	save_lines();
	!cur_file, !cur_line

let restore (file,line) =
	save_lines();
	cur_file := file;
	cur_line := line;
	lines := Hashtbl.find all_lines file

let newline lexbuf =
	lines :=  (lexeme_end lexbuf,!cur_line) :: !lines;
	incr cur_line

let find_line p lines =
	let rec loop line delta = function
		| [] -> line + 1, p - delta
		| (lp,line) :: l when lp > p -> line, p - delta
		| (lp,line) :: l -> loop line lp l
	in
	loop 0 0 lines

let get_error_line p =
	let lines = List.rev (try Hashtbl.find all_lines p.pfile with Not_found -> []) in
	let l, _ = find_line p.pmin lines in
	l	

let get_error_pos printer p =
	if p.pmin = -1 then
		"(unknown)"
	else
		let lines = List.rev (try Hashtbl.find all_lines p.pfile with Not_found -> []) in
		let l1, p1 = find_line p.pmin lines in
		let l2, p2 = find_line p.pmax lines in
		if l1 = l2 then begin
			let s = (if p1 = p2 then Printf.sprintf " %d" p1 else Printf.sprintf "s %d-%d" p1 p2) in
			Printf.sprintf "%s character%s" (printer p.pfile l1) s
		end else
			Printf.sprintf "%s lines %d-%d" (printer p.pfile l1) l1 l2

let reset() = Buffer.reset buf
let contents() = Buffer.contents buf
let store lexbuf = Buffer.add_string buf (lexeme lexbuf)
let add c = Buffer.add_string buf c

let mk_tok t pmin pmax =
	t , { pfile = !cur_file; pmin = pmin; pmax = pmax }

let mk lexbuf t =
	mk_tok t (lexeme_start lexbuf) (lexeme_end lexbuf)

let mk_ident lexbuf =
	match lexeme lexbuf with
	| s ->
		mk lexbuf (try Kwd (Hashtbl.find keywords s) with Not_found -> Const (Ident s))

let invalid_char lexbuf =
	error (Invalid_character (lexeme_char lexbuf 0)) (lexeme_start lexbuf)

type file_index = {
	f_file : string;
	f_lines : (int * int) list;
	f_max_line : int;
}

type line_index = (string, file_index) PMap.t

let make_index f lines =
	{
		f_file = f;
		f_lines = List.rev lines;
		f_max_line = (match lines with (_,line) :: _ -> line + 1 | [] -> 1);
	}

let build_line_index() =
	Hashtbl.fold (fun f l acc -> PMap.add f (make_index f l) acc) all_lines PMap.empty

let find_line_index idx p =
	let idx = (try PMap.find p.pfile idx with Not_found -> make_index p.pfile []) in
	let ppos = p.pmin in
	let rec loop = function
		| [] -> idx.f_max_line
		| (lp,line) :: l -> if lp > ppos then line else loop l
	in
	loop idx.f_lines


# 141 "lexer.ml"
let __ocaml_lex_tables = {
  Lexing.lex_base = 
   "\000\000\192\255\079\000\192\000\011\001\107\000\197\255\198\255\
    \200\255\201\255\202\255\203\255\204\255\205\255\206\255\217\255\
    \218\255\219\255\220\255\003\000\031\000\077\000\035\000\078\000\
    \079\000\192\000\080\000\095\000\189\000\193\000\191\000\088\001\
    \100\001\122\001\251\255\001\000\223\000\044\000\255\255\044\000\
    \254\255\252\255\154\001\176\001\198\001\236\001\097\000\008\002\
    \018\002\110\001\132\001\244\255\164\001\040\002\124\000\050\002\
    \223\255\199\255\232\255\017\001\235\255\242\255\224\255\234\255\
    \241\255\196\255\239\255\227\255\238\255\226\255\237\255\236\255\
    \233\255\228\255\110\000\231\255\230\255\229\255\060\002\135\002\
    \210\002\029\003\227\001\228\001\125\000\002\000\254\255\255\255\
    \253\255\142\003\143\003\250\255\101\001\004\000\254\255\255\255\
    \252\255\253\255\144\003\148\003\250\255\108\001\005\000\254\255\
    \255\255\251\255\252\255\078\003\149\003\251\255\237\000\006\000\
    \254\255\255\255\252\255\253\255\096\002\254\255\255\255";
  Lexing.lex_backtrk = 
   "\255\255\255\255\062\000\061\000\061\000\063\000\255\255\255\255\
    \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
    \255\255\255\255\255\255\033\000\048\000\034\000\045\000\043\000\
    \042\000\041\000\040\000\015\000\047\000\044\000\046\000\039\000\
    \006\000\006\000\255\255\004\000\002\000\063\000\255\255\255\255\
    \255\255\255\255\255\255\255\255\255\255\005\000\255\255\255\255\
    \007\000\010\000\255\255\255\255\009\000\255\255\255\255\008\000\
    \255\255\255\255\255\255\012\000\255\255\255\255\255\255\255\255\
    \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
    \255\255\255\255\030\000\255\255\255\255\255\255\060\000\060\000\
    \060\000\061\000\255\255\004\000\003\000\001\000\255\255\255\255\
    \255\255\255\255\006\000\255\255\004\000\001\000\255\255\255\255\
    \255\255\255\255\255\255\006\000\255\255\002\000\001\000\255\255\
    \255\255\255\255\255\255\255\255\005\000\255\255\003\000\001\000\
    \255\255\255\255\255\255\255\255\002\000\255\255\255\255";
  Lexing.lex_default = 
   "\001\000\000\000\255\255\255\255\255\255\255\255\000\000\000\000\
    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \000\000\000\000\000\000\255\255\255\255\255\255\255\255\255\255\
    \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
    \255\255\255\255\000\000\255\255\255\255\255\255\000\000\255\255\
    \000\000\000\000\255\255\255\255\255\255\255\255\255\255\255\255\
    \255\255\255\255\255\255\000\000\255\255\255\255\255\255\255\255\
    \000\000\000\000\000\000\059\000\000\000\000\000\000\000\000\000\
    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \000\000\000\000\255\255\000\000\000\000\000\000\255\255\255\255\
    \255\255\255\255\083\000\083\000\255\255\255\255\000\000\000\000\
    \000\000\090\000\090\000\000\000\255\255\255\255\000\000\000\000\
    \000\000\000\000\099\000\099\000\000\000\255\255\255\255\000\000\
    \000\000\000\000\000\000\108\000\108\000\000\000\255\255\255\255\
    \000\000\000\000\000\000\000\000\255\255\000\000\000\000";
  Lexing.lex_trans = 
   "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \000\000\036\000\034\000\041\000\086\000\035\000\094\000\103\000\
    \112\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \036\000\019\000\007\000\005\000\000\000\026\000\025\000\006\000\
    \010\000\009\000\022\000\029\000\015\000\028\000\031\000\030\000\
    \033\000\032\000\032\000\032\000\032\000\032\000\032\000\032\000\
    \032\000\032\000\016\000\017\000\021\000\020\000\018\000\008\000\
    \077\000\002\000\002\000\002\000\002\000\002\000\002\000\002\000\
    \002\000\002\000\002\000\002\000\002\000\002\000\002\000\002\000\
    \002\000\002\000\002\000\002\000\002\000\002\000\002\000\002\000\
    \002\000\002\000\002\000\014\000\076\000\013\000\023\000\004\000\
    \072\000\003\000\003\000\003\000\003\000\003\000\003\000\003\000\
    \003\000\003\000\003\000\003\000\003\000\003\000\003\000\003\000\
    \003\000\003\000\003\000\003\000\003\000\003\000\003\000\003\000\
    \003\000\003\000\003\000\012\000\024\000\011\000\027\000\002\000\
    \002\000\002\000\002\000\002\000\002\000\002\000\002\000\002\000\
    \002\000\074\000\073\000\071\000\070\000\066\000\065\000\051\000\
    \002\000\002\000\002\000\002\000\002\000\002\000\002\000\002\000\
    \002\000\002\000\002\000\002\000\002\000\002\000\002\000\002\000\
    \002\000\002\000\002\000\002\000\002\000\002\000\002\000\002\000\
    \002\000\002\000\056\000\075\000\088\000\000\000\002\000\000\000\
    \002\000\002\000\002\000\002\000\002\000\002\000\002\000\002\000\
    \002\000\002\000\002\000\002\000\002\000\002\000\002\000\002\000\
    \002\000\002\000\002\000\002\000\002\000\002\000\002\000\002\000\
    \002\000\002\000\079\000\069\000\078\000\078\000\078\000\078\000\
    \078\000\078\000\078\000\078\000\078\000\078\000\078\000\078\000\
    \078\000\078\000\078\000\078\000\078\000\078\000\078\000\078\000\
    \078\000\078\000\078\000\078\000\078\000\078\000\067\000\039\000\
    \036\000\057\000\064\000\040\000\061\000\000\000\059\000\037\000\
    \003\000\003\000\003\000\003\000\003\000\003\000\003\000\003\000\
    \003\000\003\000\063\000\062\000\058\000\068\000\060\000\036\000\
    \038\000\003\000\003\000\003\000\003\000\003\000\003\000\003\000\
    \003\000\003\000\003\000\003\000\003\000\003\000\003\000\003\000\
    \003\000\003\000\003\000\003\000\003\000\003\000\003\000\003\000\
    \003\000\003\000\003\000\255\255\115\000\000\000\255\255\003\000\
    \000\000\003\000\003\000\003\000\003\000\003\000\003\000\003\000\
    \003\000\003\000\003\000\003\000\003\000\003\000\003\000\003\000\
    \003\000\003\000\003\000\003\000\003\000\003\000\003\000\003\000\
    \003\000\003\000\003\000\081\000\081\000\081\000\081\000\081\000\
    \081\000\081\000\081\000\081\000\081\000\000\000\000\000\000\000\
    \000\000\114\000\000\000\000\000\002\000\002\000\002\000\002\000\
    \002\000\002\000\002\000\002\000\002\000\002\000\002\000\002\000\
    \002\000\002\000\002\000\002\000\002\000\002\000\002\000\002\000\
    \002\000\002\000\002\000\002\000\002\000\002\000\000\000\000\000\
    \000\000\000\000\004\000\000\000\003\000\003\000\003\000\003\000\
    \003\000\003\000\003\000\003\000\003\000\003\000\003\000\003\000\
    \003\000\003\000\003\000\003\000\003\000\003\000\003\000\003\000\
    \003\000\003\000\003\000\003\000\003\000\003\000\054\000\097\000\
    \055\000\055\000\055\000\055\000\055\000\055\000\055\000\055\000\
    \055\000\055\000\043\000\105\000\032\000\032\000\032\000\032\000\
    \032\000\032\000\032\000\032\000\032\000\032\000\049\000\049\000\
    \049\000\049\000\049\000\049\000\049\000\049\000\049\000\049\000\
    \043\000\042\000\032\000\032\000\032\000\032\000\032\000\032\000\
    \032\000\032\000\032\000\032\000\049\000\049\000\049\000\049\000\
    \049\000\049\000\049\000\049\000\049\000\049\000\000\000\042\000\
    \000\000\096\000\000\000\000\000\000\000\053\000\000\000\053\000\
    \106\000\042\000\052\000\052\000\052\000\052\000\052\000\052\000\
    \052\000\052\000\052\000\052\000\052\000\052\000\052\000\052\000\
    \052\000\052\000\052\000\052\000\052\000\052\000\046\000\042\000\
    \048\000\048\000\048\000\048\000\048\000\048\000\048\000\048\000\
    \048\000\048\000\000\000\000\000\000\000\086\000\255\255\000\000\
    \085\000\255\255\044\000\000\000\000\000\047\000\045\000\045\000\
    \045\000\045\000\045\000\045\000\045\000\045\000\045\000\045\000\
    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\045\000\
    \045\000\045\000\045\000\045\000\045\000\084\000\255\255\000\000\
    \000\000\255\255\000\000\000\000\000\000\047\000\000\000\000\000\
    \000\000\000\000\000\000\000\000\045\000\045\000\045\000\045\000\
    \045\000\045\000\045\000\045\000\045\000\045\000\000\000\045\000\
    \045\000\045\000\045\000\045\000\045\000\045\000\045\000\045\000\
    \045\000\045\000\045\000\050\000\000\000\050\000\000\000\000\000\
    \049\000\049\000\049\000\049\000\049\000\049\000\049\000\049\000\
    \049\000\049\000\048\000\048\000\048\000\048\000\048\000\048\000\
    \048\000\048\000\048\000\048\000\000\000\045\000\045\000\045\000\
    \045\000\045\000\045\000\000\000\000\000\000\000\000\000\047\000\
    \052\000\052\000\052\000\052\000\052\000\052\000\052\000\052\000\
    \052\000\052\000\055\000\055\000\055\000\055\000\055\000\055\000\
    \055\000\055\000\055\000\055\000\078\000\078\000\078\000\078\000\
    \078\000\078\000\078\000\078\000\078\000\078\000\000\000\047\000\
    \000\000\000\000\000\000\000\000\000\000\078\000\078\000\078\000\
    \078\000\078\000\078\000\078\000\078\000\078\000\078\000\078\000\
    \078\000\078\000\078\000\078\000\078\000\078\000\078\000\078\000\
    \078\000\078\000\078\000\078\000\078\000\078\000\078\000\000\000\
    \000\000\000\000\000\000\078\000\000\000\078\000\078\000\078\000\
    \078\000\078\000\078\000\078\000\078\000\078\000\078\000\078\000\
    \078\000\078\000\078\000\078\000\078\000\078\000\078\000\078\000\
    \078\000\078\000\078\000\078\000\078\000\078\000\078\000\080\000\
    \080\000\080\000\080\000\080\000\080\000\080\000\080\000\080\000\
    \080\000\117\000\117\000\117\000\117\000\117\000\117\000\118\000\
    \117\000\118\000\117\000\117\000\117\000\118\000\117\000\117\000\
    \117\000\117\000\117\000\118\000\117\000\118\000\117\000\117\000\
    \117\000\117\000\117\000\000\000\000\000\000\000\000\000\000\000\
    \000\000\000\000\000\000\087\000\255\255\000\000\079\000\000\000\
    \078\000\078\000\078\000\078\000\078\000\078\000\078\000\078\000\
    \078\000\078\000\078\000\078\000\078\000\078\000\078\000\078\000\
    \078\000\078\000\078\000\078\000\078\000\078\000\078\000\078\000\
    \078\000\078\000\080\000\080\000\080\000\080\000\080\000\080\000\
    \080\000\080\000\080\000\080\000\000\000\000\000\000\000\000\000\
    \000\000\000\000\000\000\080\000\080\000\080\000\080\000\080\000\
    \080\000\080\000\080\000\080\000\080\000\080\000\080\000\080\000\
    \080\000\080\000\080\000\080\000\080\000\080\000\080\000\080\000\
    \080\000\080\000\080\000\080\000\080\000\000\000\000\000\000\000\
    \000\000\080\000\000\000\080\000\080\000\080\000\080\000\080\000\
    \080\000\080\000\080\000\080\000\080\000\080\000\080\000\080\000\
    \080\000\080\000\080\000\080\000\080\000\080\000\080\000\080\000\
    \080\000\080\000\080\000\080\000\080\000\081\000\081\000\081\000\
    \081\000\081\000\081\000\081\000\081\000\081\000\081\000\000\000\
    \112\000\000\000\000\000\111\000\000\000\000\000\081\000\081\000\
    \081\000\081\000\081\000\081\000\081\000\081\000\081\000\081\000\
    \081\000\081\000\081\000\081\000\081\000\081\000\081\000\081\000\
    \081\000\081\000\081\000\081\000\081\000\081\000\081\000\081\000\
    \000\000\000\000\000\000\000\000\081\000\109\000\081\000\081\000\
    \081\000\081\000\081\000\081\000\081\000\081\000\081\000\081\000\
    \081\000\081\000\081\000\081\000\081\000\081\000\081\000\081\000\
    \081\000\081\000\081\000\081\000\081\000\081\000\081\000\081\000\
    \094\000\255\255\103\000\093\000\255\255\102\000\255\255\255\255\
    \000\000\255\255\255\255\000\000\000\000\000\000\000\000\000\000\
    \000\000\000\000\110\000\000\000\000\000\000\000\000\000\000\000\
    \091\000\255\255\000\000\000\000\000\000\000\000\000\000\100\000\
    \000\000\000\000\000\000\255\255\000\000\000\000\000\000\000\000\
    \000\000\000\000\000\000\000\000\255\255\000\000\000\000\000\000\
    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \000\000\000\000\092\000\255\255\101\000\000\000\000\000\000\000\
    \255\255\255\255\000\000\000\000\000\000\000\000\000\000\000\000\
    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \000\000\000\000\000\000\000\000\000\000\000\000\113\000\000\000\
    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \000\000\000\000\000\000\000\000\000\000\000\000\095\000\255\255\
    \104\000\000\000\000\000\000\000\255\255\255\255";
  Lexing.lex_check = 
   "\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
    \255\255\000\000\000\000\035\000\085\000\000\000\093\000\102\000\
    \111\000\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
    \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
    \000\000\000\000\000\000\000\000\255\255\000\000\000\000\000\000\
    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \019\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \000\000\000\000\000\000\000\000\020\000\000\000\000\000\000\000\
    \022\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
    \000\000\000\000\000\000\000\000\000\000\000\000\000\000\002\000\
    \002\000\002\000\002\000\002\000\002\000\002\000\002\000\002\000\
    \002\000\021\000\021\000\023\000\024\000\026\000\027\000\046\000\
    \002\000\002\000\002\000\002\000\002\000\002\000\002\000\002\000\
    \002\000\002\000\002\000\002\000\002\000\002\000\002\000\002\000\
    \002\000\002\000\002\000\002\000\002\000\002\000\002\000\002\000\
    \002\000\002\000\054\000\074\000\084\000\255\255\002\000\255\255\
    \002\000\002\000\002\000\002\000\002\000\002\000\002\000\002\000\
    \002\000\002\000\002\000\002\000\002\000\002\000\002\000\002\000\
    \002\000\002\000\002\000\002\000\002\000\002\000\002\000\002\000\
    \002\000\002\000\005\000\024\000\005\000\005\000\005\000\005\000\
    \005\000\005\000\005\000\005\000\005\000\005\000\005\000\005\000\
    \005\000\005\000\005\000\005\000\005\000\005\000\005\000\005\000\
    \005\000\005\000\005\000\005\000\005\000\005\000\025\000\037\000\
    \036\000\030\000\028\000\039\000\029\000\255\255\030\000\000\000\
    \003\000\003\000\003\000\003\000\003\000\003\000\003\000\003\000\
    \003\000\003\000\028\000\028\000\030\000\025\000\029\000\036\000\
    \000\000\003\000\003\000\003\000\003\000\003\000\003\000\003\000\
    \003\000\003\000\003\000\003\000\003\000\003\000\003\000\003\000\
    \003\000\003\000\003\000\003\000\003\000\003\000\003\000\003\000\
    \003\000\003\000\003\000\059\000\110\000\255\255\059\000\003\000\
    \255\255\003\000\003\000\003\000\003\000\003\000\003\000\003\000\
    \003\000\003\000\003\000\003\000\003\000\003\000\003\000\003\000\
    \003\000\003\000\003\000\003\000\003\000\003\000\003\000\003\000\
    \003\000\003\000\003\000\004\000\004\000\004\000\004\000\004\000\
    \004\000\004\000\004\000\004\000\004\000\255\255\255\255\255\255\
    \255\255\110\000\255\255\255\255\004\000\004\000\004\000\004\000\
    \004\000\004\000\004\000\004\000\004\000\004\000\004\000\004\000\
    \004\000\004\000\004\000\004\000\004\000\004\000\004\000\004\000\
    \004\000\004\000\004\000\004\000\004\000\004\000\255\255\255\255\
    \255\255\255\255\004\000\255\255\004\000\004\000\004\000\004\000\
    \004\000\004\000\004\000\004\000\004\000\004\000\004\000\004\000\
    \004\000\004\000\004\000\004\000\004\000\004\000\004\000\004\000\
    \004\000\004\000\004\000\004\000\004\000\004\000\031\000\092\000\
    \031\000\031\000\031\000\031\000\031\000\031\000\031\000\031\000\
    \031\000\031\000\032\000\101\000\032\000\032\000\032\000\032\000\
    \032\000\032\000\032\000\032\000\032\000\032\000\049\000\049\000\
    \049\000\049\000\049\000\049\000\049\000\049\000\049\000\049\000\
    \033\000\032\000\033\000\033\000\033\000\033\000\033\000\033\000\
    \033\000\033\000\033\000\033\000\050\000\050\000\050\000\050\000\
    \050\000\050\000\050\000\050\000\050\000\050\000\255\255\033\000\
    \255\255\092\000\255\255\255\255\255\255\042\000\255\255\042\000\
    \101\000\032\000\042\000\042\000\042\000\042\000\042\000\042\000\
    \042\000\042\000\042\000\042\000\052\000\052\000\052\000\052\000\
    \052\000\052\000\052\000\052\000\052\000\052\000\043\000\033\000\
    \043\000\043\000\043\000\043\000\043\000\043\000\043\000\043\000\
    \043\000\043\000\255\255\255\255\255\255\082\000\083\000\255\255\
    \082\000\083\000\033\000\255\255\255\255\043\000\044\000\044\000\
    \044\000\044\000\044\000\044\000\044\000\044\000\044\000\044\000\
    \255\255\255\255\255\255\255\255\255\255\255\255\255\255\044\000\
    \044\000\044\000\044\000\044\000\044\000\082\000\083\000\255\255\
    \255\255\059\000\255\255\255\255\255\255\043\000\255\255\255\255\
    \255\255\255\255\255\255\255\255\045\000\045\000\045\000\045\000\
    \045\000\045\000\045\000\045\000\045\000\045\000\255\255\044\000\
    \044\000\044\000\044\000\044\000\044\000\045\000\045\000\045\000\
    \045\000\045\000\045\000\047\000\255\255\047\000\255\255\255\255\
    \047\000\047\000\047\000\047\000\047\000\047\000\047\000\047\000\
    \047\000\047\000\048\000\048\000\048\000\048\000\048\000\048\000\
    \048\000\048\000\048\000\048\000\255\255\045\000\045\000\045\000\
    \045\000\045\000\045\000\255\255\255\255\255\255\255\255\048\000\
    \053\000\053\000\053\000\053\000\053\000\053\000\053\000\053\000\
    \053\000\053\000\055\000\055\000\055\000\055\000\055\000\055\000\
    \055\000\055\000\055\000\055\000\078\000\078\000\078\000\078\000\
    \078\000\078\000\078\000\078\000\078\000\078\000\255\255\048\000\
    \255\255\255\255\255\255\255\255\255\255\078\000\078\000\078\000\
    \078\000\078\000\078\000\078\000\078\000\078\000\078\000\078\000\
    \078\000\078\000\078\000\078\000\078\000\078\000\078\000\078\000\
    \078\000\078\000\078\000\078\000\078\000\078\000\078\000\255\255\
    \255\255\255\255\255\255\078\000\255\255\078\000\078\000\078\000\
    \078\000\078\000\078\000\078\000\078\000\078\000\078\000\078\000\
    \078\000\078\000\078\000\078\000\078\000\078\000\078\000\078\000\
    \078\000\078\000\078\000\078\000\078\000\078\000\078\000\079\000\
    \079\000\079\000\079\000\079\000\079\000\079\000\079\000\079\000\
    \079\000\116\000\116\000\116\000\116\000\116\000\116\000\116\000\
    \116\000\116\000\116\000\116\000\116\000\116\000\116\000\116\000\
    \116\000\116\000\116\000\116\000\116\000\116\000\116\000\116\000\
    \116\000\116\000\116\000\255\255\255\255\255\255\255\255\255\255\
    \255\255\255\255\255\255\082\000\083\000\255\255\079\000\255\255\
    \079\000\079\000\079\000\079\000\079\000\079\000\079\000\079\000\
    \079\000\079\000\079\000\079\000\079\000\079\000\079\000\079\000\
    \079\000\079\000\079\000\079\000\079\000\079\000\079\000\079\000\
    \079\000\079\000\080\000\080\000\080\000\080\000\080\000\080\000\
    \080\000\080\000\080\000\080\000\255\255\255\255\255\255\255\255\
    \255\255\255\255\255\255\080\000\080\000\080\000\080\000\080\000\
    \080\000\080\000\080\000\080\000\080\000\080\000\080\000\080\000\
    \080\000\080\000\080\000\080\000\080\000\080\000\080\000\080\000\
    \080\000\080\000\080\000\080\000\080\000\255\255\255\255\255\255\
    \255\255\080\000\255\255\080\000\080\000\080\000\080\000\080\000\
    \080\000\080\000\080\000\080\000\080\000\080\000\080\000\080\000\
    \080\000\080\000\080\000\080\000\080\000\080\000\080\000\080\000\
    \080\000\080\000\080\000\080\000\080\000\081\000\081\000\081\000\
    \081\000\081\000\081\000\081\000\081\000\081\000\081\000\255\255\
    \107\000\255\255\255\255\107\000\255\255\255\255\081\000\081\000\
    \081\000\081\000\081\000\081\000\081\000\081\000\081\000\081\000\
    \081\000\081\000\081\000\081\000\081\000\081\000\081\000\081\000\
    \081\000\081\000\081\000\081\000\081\000\081\000\081\000\081\000\
    \255\255\255\255\255\255\255\255\081\000\107\000\081\000\081\000\
    \081\000\081\000\081\000\081\000\081\000\081\000\081\000\081\000\
    \081\000\081\000\081\000\081\000\081\000\081\000\081\000\081\000\
    \081\000\081\000\081\000\081\000\081\000\081\000\081\000\081\000\
    \089\000\090\000\098\000\089\000\090\000\098\000\099\000\108\000\
    \255\255\099\000\108\000\255\255\255\255\255\255\255\255\255\255\
    \255\255\255\255\107\000\255\255\255\255\255\255\255\255\255\255\
    \089\000\090\000\255\255\255\255\255\255\255\255\255\255\098\000\
    \255\255\255\255\255\255\099\000\255\255\255\255\255\255\255\255\
    \255\255\255\255\255\255\255\255\108\000\255\255\255\255\255\255\
    \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
    \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
    \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
    \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
    \255\255\255\255\089\000\090\000\098\000\255\255\255\255\255\255\
    \099\000\108\000\255\255\255\255\255\255\255\255\255\255\255\255\
    \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
    \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
    \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
    \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
    \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
    \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
    \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
    \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
    \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
    \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
    \255\255\255\255\255\255\255\255\255\255\255\255\107\000\255\255\
    \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
    \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
    \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
    \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
    \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
    \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
    \255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\255\
    \255\255\255\255\255\255\255\255\255\255\255\255\089\000\090\000\
    \098\000\255\255\255\255\255\255\099\000\108\000";
  Lexing.lex_base_code = 
   "";
  Lexing.lex_backtrk_code = 
   "";
  Lexing.lex_default_code = 
   "";
  Lexing.lex_trans_code = 
   "";
  Lexing.lex_check_code = 
   "";
  Lexing.lex_code = 
   "";
}

let rec token lexbuf =
    __ocaml_lex_token_rec lexbuf 0
and __ocaml_lex_token_rec lexbuf __ocaml_lex_state =
  match Lexing.engine __ocaml_lex_tables __ocaml_lex_state lexbuf with
      | 0 ->
# 163 "lexer.mll"
       ( mk lexbuf Eof )
# 508 "lexer.ml"

  | 1 ->
# 164 "lexer.mll"
                  ( token lexbuf )
# 513 "lexer.ml"

  | 2 ->
# 165 "lexer.mll"
               ( token lexbuf )
# 518 "lexer.ml"

  | 3 ->
# 166 "lexer.mll"
          ( newline lexbuf; token lexbuf )
# 523 "lexer.ml"

  | 4 ->
# 167 "lexer.mll"
               ( newline lexbuf; token lexbuf )
# 528 "lexer.ml"

  | 5 ->
# 168 "lexer.mll"
                                   ( mk lexbuf (Const (Int (lexeme lexbuf))) )
# 533 "lexer.ml"

  | 6 ->
# 169 "lexer.mll"
              ( mk lexbuf (Const (Int (lexeme lexbuf))) )
# 538 "lexer.ml"

  | 7 ->
# 170 "lexer.mll"
                             ( mk lexbuf (Const (Float (lexeme lexbuf))) )
# 543 "lexer.ml"

  | 8 ->
# 171 "lexer.mll"
                  ( mk lexbuf (Const (Float (lexeme lexbuf))) )
# 548 "lexer.ml"

  | 9 ->
# 172 "lexer.mll"
                                              ( mk lexbuf (Const (Float (lexeme lexbuf))) )
# 553 "lexer.ml"

  | 10 ->
# 173 "lexer.mll"
                                                             ( mk lexbuf (Const (Float (lexeme lexbuf))) )
# 558 "lexer.ml"

  | 11 ->
# 174 "lexer.mll"
                    (
			let s = lexeme lexbuf in
			mk lexbuf (IntInterval (String.sub s 0 (String.length s - 3)))
		)
# 566 "lexer.ml"

  | 12 ->
# 178 "lexer.mll"
                       (
			let s = lexeme lexbuf in
			mk lexbuf (CommentLine (String.sub s 2 ((String.length s)-2)))
		)
# 574 "lexer.ml"

  | 13 ->
# 182 "lexer.mll"
        ( mk lexbuf (Unop Increment) )
# 579 "lexer.ml"

  | 14 ->
# 183 "lexer.mll"
        ( mk lexbuf (Unop Decrement) )
# 584 "lexer.ml"

  | 15 ->
# 184 "lexer.mll"
        ( mk lexbuf (Unop NegBits) )
# 589 "lexer.ml"

  | 16 ->
# 185 "lexer.mll"
        ( mk lexbuf (Binop (OpAssignOp OpMod)) )
# 594 "lexer.ml"

  | 17 ->
# 186 "lexer.mll"
        ( mk lexbuf (Binop (OpAssignOp OpAnd)) )
# 599 "lexer.ml"

  | 18 ->
# 187 "lexer.mll"
        ( mk lexbuf (Binop (OpAssignOp OpOr)) )
# 604 "lexer.ml"

  | 19 ->
# 188 "lexer.mll"
        ( mk lexbuf (Binop (OpAssignOp OpXor)) )
# 609 "lexer.ml"

  | 20 ->
# 189 "lexer.mll"
        ( mk lexbuf (Binop (OpAssignOp OpAdd)) )
# 614 "lexer.ml"

  | 21 ->
# 190 "lexer.mll"
        ( mk lexbuf (Binop (OpAssignOp OpSub)) )
# 619 "lexer.ml"

  | 22 ->
# 191 "lexer.mll"
        ( mk lexbuf (Binop (OpAssignOp OpMult)) )
# 624 "lexer.ml"

  | 23 ->
# 192 "lexer.mll"
        ( mk lexbuf (Binop (OpAssignOp OpDiv)) )
# 629 "lexer.ml"

  | 24 ->
# 193 "lexer.mll"
         ( mk lexbuf (Binop (OpAssignOp OpShl)) )
# 634 "lexer.ml"

  | 25 ->
# 196 "lexer.mll"
        ( mk lexbuf (Binop OpEq) )
# 639 "lexer.ml"

  | 26 ->
# 197 "lexer.mll"
        ( mk lexbuf (Binop OpNotEq) )
# 644 "lexer.ml"

  | 27 ->
# 198 "lexer.mll"
        ( mk lexbuf (Binop OpLte) )
# 649 "lexer.ml"

  | 28 ->
# 200 "lexer.mll"
        ( mk lexbuf (Binop OpBoolAnd) )
# 654 "lexer.ml"

  | 29 ->
# 201 "lexer.mll"
        ( mk lexbuf (Binop OpBoolOr) )
# 659 "lexer.ml"

  | 30 ->
# 202 "lexer.mll"
        ( mk lexbuf (Binop OpShl) )
# 664 "lexer.ml"

  | 31 ->
# 203 "lexer.mll"
        ( mk lexbuf Arrow )
# 669 "lexer.ml"

  | 32 ->
# 204 "lexer.mll"
         ( mk lexbuf (Binop OpInterval) )
# 674 "lexer.ml"

  | 33 ->
# 205 "lexer.mll"
       ( mk lexbuf (Unop Not) )
# 679 "lexer.ml"

  | 34 ->
# 206 "lexer.mll"
       ( mk lexbuf (Binop OpLt) )
# 684 "lexer.ml"

  | 35 ->
# 207 "lexer.mll"
       ( mk lexbuf (Binop OpGt) )
# 689 "lexer.ml"

  | 36 ->
# 208 "lexer.mll"
       ( mk lexbuf Semicolon )
# 694 "lexer.ml"

  | 37 ->
# 209 "lexer.mll"
       ( mk lexbuf DblDot )
# 699 "lexer.ml"

  | 38 ->
# 210 "lexer.mll"
       ( mk lexbuf Comma )
# 704 "lexer.ml"

  | 39 ->
# 211 "lexer.mll"
       ( mk lexbuf Dot )
# 709 "lexer.ml"

  | 40 ->
# 212 "lexer.mll"
       ( mk lexbuf (Binop OpMod) )
# 714 "lexer.ml"

  | 41 ->
# 213 "lexer.mll"
       ( mk lexbuf (Binop OpAnd) )
# 719 "lexer.ml"

  | 42 ->
# 214 "lexer.mll"
       ( mk lexbuf (Binop OpOr) )
# 724 "lexer.ml"

  | 43 ->
# 215 "lexer.mll"
       ( mk lexbuf (Binop OpXor) )
# 729 "lexer.ml"

  | 44 ->
# 216 "lexer.mll"
       ( mk lexbuf (Binop OpAdd) )
# 734 "lexer.ml"

  | 45 ->
# 217 "lexer.mll"
       ( mk lexbuf (Binop OpMult) )
# 739 "lexer.ml"

  | 46 ->
# 218 "lexer.mll"
       ( mk lexbuf (Binop OpDiv) )
# 744 "lexer.ml"

  | 47 ->
# 219 "lexer.mll"
       ( mk lexbuf (Binop OpSub) )
# 749 "lexer.ml"

  | 48 ->
# 220 "lexer.mll"
       ( mk lexbuf (Binop OpAssign) )
# 754 "lexer.ml"

  | 49 ->
# 221 "lexer.mll"
       ( mk lexbuf BkOpen )
# 759 "lexer.ml"

  | 50 ->
# 222 "lexer.mll"
       ( mk lexbuf BkClose )
# 764 "lexer.ml"

  | 51 ->
# 223 "lexer.mll"
       ( mk lexbuf BrOpen )
# 769 "lexer.ml"

  | 52 ->
# 224 "lexer.mll"
       ( mk lexbuf BrClose )
# 774 "lexer.ml"

  | 53 ->
# 225 "lexer.mll"
       ( mk lexbuf POpen )
# 779 "lexer.ml"

  | 54 ->
# 226 "lexer.mll"
       ( mk lexbuf PClose )
# 784 "lexer.ml"

  | 55 ->
# 227 "lexer.mll"
       ( mk lexbuf Question )
# 789 "lexer.ml"

  | 56 ->
# 228 "lexer.mll"
        (
			reset();
			let pmin = lexeme_start lexbuf in
			let pmax = (try comment lexbuf with Exit -> error Unclosed_comment pmin) in
			mk_tok (Comment (contents())) pmin pmax;
		)
# 799 "lexer.ml"

  | 57 ->
# 234 "lexer.mll"
       (
			reset();
			let pmin = lexeme_start lexbuf in
			let pmax = (try string lexbuf with Exit -> error Unterminated_string pmin) in
			let str = (try unescape (contents()) with Exit -> error Invalid_escape pmin) in
			mk_tok (Const (String str)) pmin pmax;
		)
# 810 "lexer.ml"

  | 58 ->
# 241 "lexer.mll"
       (
			reset();
			let pmin = lexeme_start lexbuf in
			let pmax = (try string2 lexbuf with Exit -> error Unterminated_string pmin) in
			let str = (try unescape (contents()) with Exit -> error Invalid_escape pmin) in
			mk_tok (Const (String str)) pmin pmax;
		)
# 821 "lexer.ml"

  | 59 ->
# 248 "lexer.mll"
        (
			reset();
			let pmin = lexeme_start lexbuf in
			let options, pmax = (try regexp lexbuf with Exit -> error Unterminated_regexp pmin) in
			let str = contents() in
			mk_tok (Const (Regexp (str,options))) pmin pmax;
		)
# 832 "lexer.ml"

  | 60 ->
# 255 "lexer.mll"
             (
			let v = lexeme lexbuf in
			let v = String.sub v 1 (String.length v - 1) in
			mk lexbuf (Macro v)
		)
# 841 "lexer.ml"

  | 61 ->
# 260 "lexer.mll"
         ( mk_ident lexbuf )
# 846 "lexer.ml"

  | 62 ->
# 261 "lexer.mll"
          ( mk lexbuf (Const (Type (lexeme lexbuf))) )
# 851 "lexer.ml"

  | 63 ->
# 262 "lexer.mll"
     ( invalid_char lexbuf )
# 856 "lexer.ml"

  | __ocaml_lex_state -> lexbuf.Lexing.refill_buff lexbuf; __ocaml_lex_token_rec lexbuf __ocaml_lex_state

and comment lexbuf =
    __ocaml_lex_comment_rec lexbuf 82
and __ocaml_lex_comment_rec lexbuf __ocaml_lex_state =
  match Lexing.engine __ocaml_lex_tables __ocaml_lex_state lexbuf with
      | 0 ->
# 265 "lexer.mll"
       ( raise Exit )
# 867 "lexer.ml"

  | 1 ->
# 266 "lexer.mll"
                        ( newline lexbuf; store lexbuf; comment lexbuf )
# 872 "lexer.ml"

  | 2 ->
# 267 "lexer.mll"
        ( lexeme_end lexbuf )
# 877 "lexer.ml"

  | 3 ->
# 268 "lexer.mll"
       ( store lexbuf; comment lexbuf )
# 882 "lexer.ml"

  | 4 ->
# 269 "lexer.mll"
                     ( store lexbuf; comment lexbuf )
# 887 "lexer.ml"

  | __ocaml_lex_state -> lexbuf.Lexing.refill_buff lexbuf; __ocaml_lex_comment_rec lexbuf __ocaml_lex_state

and string lexbuf =
    __ocaml_lex_string_rec lexbuf 89
and __ocaml_lex_string_rec lexbuf __ocaml_lex_state =
  match Lexing.engine __ocaml_lex_tables __ocaml_lex_state lexbuf with
      | 0 ->
# 272 "lexer.mll"
       ( raise Exit )
# 898 "lexer.ml"

  | 1 ->
# 273 "lexer.mll"
                        ( newline lexbuf; store lexbuf; string lexbuf )
# 903 "lexer.ml"

  | 2 ->
# 274 "lexer.mll"
          ( store lexbuf; string lexbuf )
# 908 "lexer.ml"

  | 3 ->
# 275 "lexer.mll"
          ( store lexbuf; string lexbuf )
# 913 "lexer.ml"

  | 4 ->
# 276 "lexer.mll"
        ( store lexbuf; string lexbuf )
# 918 "lexer.ml"

  | 5 ->
# 277 "lexer.mll"
       ( lexeme_end lexbuf )
# 923 "lexer.ml"

  | 6 ->
# 278 "lexer.mll"
                          ( store lexbuf; string lexbuf )
# 928 "lexer.ml"

  | __ocaml_lex_state -> lexbuf.Lexing.refill_buff lexbuf; __ocaml_lex_string_rec lexbuf __ocaml_lex_state

and string2 lexbuf =
    __ocaml_lex_string2_rec lexbuf 98
and __ocaml_lex_string2_rec lexbuf __ocaml_lex_state =
  match Lexing.engine __ocaml_lex_tables __ocaml_lex_state lexbuf with
      | 0 ->
# 281 "lexer.mll"
       ( raise Exit )
# 939 "lexer.ml"

  | 1 ->
# 282 "lexer.mll"
                        ( newline lexbuf; store lexbuf; string2 lexbuf )
# 944 "lexer.ml"

  | 2 ->
# 283 "lexer.mll"
        ( store lexbuf; string2 lexbuf )
# 949 "lexer.ml"

  | 3 ->
# 284 "lexer.mll"
          ( store lexbuf; string2 lexbuf )
# 954 "lexer.ml"

  | 4 ->
# 285 "lexer.mll"
         ( store lexbuf; string2 lexbuf )
# 959 "lexer.ml"

  | 5 ->
# 286 "lexer.mll"
       ( lexeme_end lexbuf )
# 964 "lexer.ml"

  | 6 ->
# 287 "lexer.mll"
                           ( store lexbuf; string2 lexbuf )
# 969 "lexer.ml"

  | __ocaml_lex_state -> lexbuf.Lexing.refill_buff lexbuf; __ocaml_lex_string2_rec lexbuf __ocaml_lex_state

and regexp lexbuf =
    __ocaml_lex_regexp_rec lexbuf 107
and __ocaml_lex_regexp_rec lexbuf __ocaml_lex_state =
  match Lexing.engine __ocaml_lex_tables __ocaml_lex_state lexbuf with
      | 0 ->
# 290 "lexer.mll"
       ( raise Exit )
# 980 "lexer.ml"

  | 1 ->
# 291 "lexer.mll"
                        ( newline lexbuf; store lexbuf; regexp lexbuf )
# 985 "lexer.ml"

  | 2 ->
# 292 "lexer.mll"
         ( add "/"; regexp lexbuf )
# 990 "lexer.ml"

  | 3 ->
# 293 "lexer.mll"
                 ( store lexbuf; regexp lexbuf )
# 995 "lexer.ml"

  | 4 ->
# 294 "lexer.mll"
       ( regexp_options lexbuf, lexeme_end lexbuf )
# 1000 "lexer.ml"

  | 5 ->
# 295 "lexer.mll"
                           ( store lexbuf; regexp lexbuf )
# 1005 "lexer.ml"

  | __ocaml_lex_state -> lexbuf.Lexing.refill_buff lexbuf; __ocaml_lex_regexp_rec lexbuf __ocaml_lex_state

and regexp_options lexbuf =
    __ocaml_lex_regexp_options_rec lexbuf 116
and __ocaml_lex_regexp_options_rec lexbuf __ocaml_lex_state =
  match Lexing.engine __ocaml_lex_tables __ocaml_lex_state lexbuf with
      | 0 ->
# 298 "lexer.mll"
                               (
			let l = lexeme lexbuf in
			l ^ regexp_options lexbuf
		)
# 1019 "lexer.ml"

  | 1 ->
# 302 "lexer.mll"
               ( error Invalid_option (lexeme_start lexbuf) )
# 1024 "lexer.ml"

  | 2 ->
# 303 "lexer.mll"
      ( "" )
# 1029 "lexer.ml"

  | __ocaml_lex_state -> lexbuf.Lexing.refill_buff lexbuf; __ocaml_lex_regexp_options_rec lexbuf __ocaml_lex_state

;;

